//
//  ImageNewsTableViewCell.m
//  Four_years
//
//  Created by 张跃骞 on 15/11/11.
//  Copyright © 2015年 中软三班四年小组. All rights reserved.
//

#import "ImageNewsTableViewCell.h"
#import "FollowUpPostLabel.h"

#define Image_Width (WIDTH - 10 * 2 - 5 * 2) / 3

@implementation ImageNewsTableViewCell

- (instancetype)init {
    if (self = [super init]) {
        _newsTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 21)];
        _newsTitle.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_newsTitle];
        
        _followUpPost = [[FollowUpPostLabel alloc] initWithCenter:CGPointMake(WIDTH - 30, 19.5)];
        _followUpPost.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_followUpPost];
        
        for (int i = 0; i < 3; i ++) {
            UIImageView *newsImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 + (Image_Width + 5) * i, 31 + 10, Image_Width, 120 - 31 - 10 - 10)];
            newsImageView.backgroundColor = [UIColor blackColor];
            newsImageView.tag = i;
            [self.contentView addSubview:newsImageView];
        }
    }
    return self;
}

- (void)setNewsTitle:(NSString *)newsTitle newsImageNameArr:(NSArray *)newsImageNameArr followUpPost:(NSInteger)followUpPostNumber {
    _newsTitle.text = newsTitle;
    
    for (int i = 0; i < 3 ; i ++) {
        UIImageView *newsImageView = [self.contentView viewWithTag:i];
        newsImageView.image = [UIImage imageNamed:newsImageNameArr[i]];
    }
    
    _followUpPost.text = [NSString stringWithFormat:@"%ld跟帖",(long)followUpPostNumber];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
